#!ipxe

goto ${menu} ||

:live_menu
set os BackBox
menu ${os}
item --gap ${os} Versions
item 7 ${space} ${os} 7
item 6 ${space} ${os} 6
choose live_version || goto live_exit
goto ${live_version}

{% for key, value in endpoints.items() | sort %}
{% if value.os == "BackBox" and 'squash' in key %}
{% set kernel_name = value.kernel %}
:{{ value.version }}
set squash_url ${live_endpoint}{{ value.path }}filesystem.squashfs
{% for key, value in endpoints.items() | sort %}
{% if key == kernel_name %}
set kernel_url ${live_endpoint}{{ value.path }}
{% endif %}
{% endfor %}
goto {{ value.version }}-boot
{% endif %}
{% endfor %}

:6-boot
imgfree
kernel ${kernel_url}vmlinuz ip=dhcp boot=casper netboot=http fetch=${squash_url} {{ kernel_params }}
initrd ${kernel_url}initrd
boot

:7-boot
imgfree
kernel ${kernel_url}vmlinuz ip=dhcp boot=casper netboot=url url=${squash_url} {{ kernel_params }}
initrd ${kernel_url}initrd
boot

:live_exit
clear menu
exit 0

